<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Examples</title>
<meta name="description" content="">
<meta name="keywords" content="">
<link href="" rel="stylesheet">

<script type="text/javascript" src="lib/vue.js"></script>
</head>
<body>
    <div id="box">
      父组件
     <child @myevent2="handleEvent($event)"></child>
    </div>
   

    <script type="text/javascript">
        //子组件
        Vue.component("child",{
        template:`<div>
          child组件
          <button @click="payMoney()">click</button>
        </div>`,

        data(){
          return {
            childname:"子组件的状态"
          }
        },
        methods:{
          payMoney(){
            this.$emit("myevent2",this.childname)// 分发 事件
          }
        }
      })


      new Vue({
        el:"#box",
        methods:{
          handleEvent(ev){
            console.log("父组件收到钱了",ev)
          } 
        }
      })
       

    </script>
</body>
</html>